package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.SystemDictionary;
import cn.wolfcode.crm.mapper.SystemDictionaryMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.ISystemDictionaryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemDictionaryServiceImpl implements ISystemDictionaryService {

	@Autowired
	private SystemDictionaryMapper dictionaryMapper;


	@Override
	public void insert(SystemDictionary entity) {
		
		dictionaryMapper.insert(entity);
	}

	@Override
	public SystemDictionary selectByPrimaryKey(Long id) {
		
		return dictionaryMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<SystemDictionary> selectAll() {
		
		return dictionaryMapper.selectAll();
	}

	@Override
	public void updateByPrimaryKey(SystemDictionary entity) {
		
		dictionaryMapper.updateByPrimaryKey(entity);
	}

	@Override
	public PageInfo query(QueryObject qo) {
		//查询总记录数

		PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
		List<SystemDictionary> data = dictionaryMapper.queryForList(qo);
		return new PageInfo<SystemDictionary>(data);
	}

}
